From: Corey Berla Date: Mon, 25 Jul 2022 03:55:22 +0000 (-0700) Subject: mountoperation: Free user_widgets list upon dialog destruction X-Git-Tag: archive/raspbian/4.8.3+ds-2+rpi1~3^2~81^2^2~23^2 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=111929593aa995c3286b84ad118280357cfe6bdd;p=gtk4.git mountoperation: Free user_widgets list upon dialog destruction There's a list user_widgets that contains all of the entries and selections during authentication. This is only freed upon finalizing the GtkMountOperation. It's possible (and true for the GVFS SMB implementation) that a MountOperation can have the gtk_mount_operation_ask_password_do_gtk () function called multiple times (i.e. bad password). The user_widgets list grows with now invalid pointers to old widgets (causing unexpected behavior and seg faults). Free the user_widgets list upon dialog destruction, we don't need it anymore. Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5059 Fixes: https://gitlab.gnome.org/GNOME/gtk/-/issues/5058 --- diff --git a/gtk/gtkmountoperation.c b/gtk/gtkmountoperation.c index 87f2647849..90383811a1 100644 --- a/gtk/gtkmountoperation.c +++ b/gtk/gtkmountoperation.c @@ -400,6 +400,10 @@ pw_dialog_got_response (GtkDialog *dialog, else g_mount_operation_reply (op, G_MOUNT_OPERATION_ABORTED); + if (priv->user_widgets) + g_list_free (priv->user_widgets); + + priv->user_widgets = NULL; priv->dialog = NULL; g_object_notify (G_OBJECT (op), "is-showing"); gtk_window_destroy (GTK_WINDOW (dialog));